package net.apexes.demo.codegen.dslite.qvar;

import java.math.BigDecimal;
import net.apexes.demo.codegen.dslite.entity.Sutrax;
import net.apexes.demo.codegen.dslite.qvar.base.QEntityBase;
import net.wafo.dslite.core.info.Index;

import net.wafo.dslite.core.dsl.*;

/**
 * QSutrax is a DSLite query type for Sutrax
 * @see Sutrax
 */
public class QSutrax extends QEntityBase<Sutrax> {

    public static final QSutrax $ = new QSutrax("SUTRAX");

    public final StringColumn name = varchar("NAME", 32).field("name").notNull().build();

    public final NumberColumn<Integer> seqOrder = integer("SEQ_ORDER").field("seqOrder").notNull().build();

    public final NumberColumn<BigDecimal> price = decimal("PRICE", 12, 3).field("price").notNull().build();

    public final StringColumn templateId = varchar("TEMPLATE_ID", 22).field("templateId").notNull().build();

    public class Indexs {

        public final Index primaryKey92 = index("PRIMARY_KEY_92").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QSutrax(String tableName) {
        super(Sutrax.class, tableName);
    }

    @Override
    public Sutrax newEntity() {
        return new Sutrax();
    }

    @Override
    public Object getFieldValue(Sutrax entity, String fieldName) {
        switch (fieldName) {
            case "name":
                return entity.getName();
            case "seqOrder":
                return entity.getSeqOrder();
            case "price":
                return entity.getPrice();
            case "templateId":
                return entity.getTemplateId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(Sutrax entity, String fieldName, Object value) {
        switch (fieldName) {
            case "name":
                entity.setName((java.lang.String) value);
                break;
            case "seqOrder":
                entity.setSeqOrder((java.lang.Integer) value);
                break;
            case "price":
                entity.setPrice((java.math.BigDecimal) value);
                break;
            case "templateId":
                entity.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

